package com.tjrac.generalpermissions.domain;

import com.tjrac.filter.entity.Verification;

import java.util.Objects;

/**
 * 权限实体类
 *
 * @author ZeNing
 * @create 2020-11-22 10:36
 */
public class Permission implements Verification {

    private Integer id;  //权限id 主键 自增
    private String name; //权限名称 非空
    private String desc; //权限描述
    private String link; //资源链接
    private Integer ptid; //权限类型

    public Permission() {
    }

    public Permission(Integer id) {
        this.id = id;
    }

    public Permission(String name, String desc, String link, Integer ptid) {
        this.name = name;
        this.desc = desc;
        this.link = link;
        this.ptid = ptid;
    }

    public Permission(Integer id, String name, String desc, String link, Integer ptid) {
        this.id = id;
        this.name = name;
        this.desc = desc;
        this.link = link;
        this.ptid = ptid;
    }

    public Integer getPtid() {
        return ptid;
    }

    public void setPtid(Integer ptid) {
        this.ptid = ptid;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String getLink() {
        return link;
    }

    @Override
    public void setLink(String link) {
        this.link = link;
    }

    @Override
    public Integer getId() {
        return id;
    }

    @Override
    public void setId(Integer integer) {
        this.id = integer;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String s) {
        this.name = s;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name);
    }

    @Override
    public boolean equals(Verification o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        return Objects.equals(id, o.getId()) &&
                Objects.equals(name, o.getName());
    }

    @Override
    public String toString() {
        return "Permission{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                ", link='" + link + '\'' +
                ", ptid=" + ptid +
                '}';
    }
}
